[UART/SERIAL] CTS / RTS pins were swapped in this API #6816
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
espressif/esp-idf / components/driver/include/driver/uart.h defines the API:
esp_err_t uart_set_pin(uart_port_t uart_num, int tx_io_num, int rx_io_num, int rts_io_num, int cts_io_num);
uartSetPins uses that api but calls it with swapped CTS/RTS pins as its API uses a different pin ordering:
uart_set_pin(uart->num, txPin, rxPin, ctsPin, rtsPin);
This fixes the wrong order in the function uartSetPins
Users that have so far successfully used the API so far will need to change their code. Another possibility would be to swap the arguments in the functions uartSetPins of the cores/esp32/esp32-hal-uart.c driver and up in the HardwareSerial. But then the order of the arguments is less logic: as TX/RX is different in arduino and esp_idf but handled correctly in this function.